// Created from GenerationTemplate
// For Decisions HL7 Engine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Reflection;
using DecisionsFramework.Design.Properties;
using Decisions.HL7.Generated.AbstractMessage;
using Decisions.HL7.DataTypes;
using ST = System.String;
using SI = System.String;
using TX = System.String;
using FT = System.String;
using IS = System.String;
using ID = System.String;
using SNM = System.String;

namespace Decisions.HL7.Message
{
    [DataContract]
	public class DFT_P11 : AbstractMessage
    {
		/// Constructor
		public DFT_P11() : base()
        {
			if (MSH != null) {
                MSH.MessageType = new MSG() { MessageCode = "DFT", TriggerEvent = "P11" };
			}
        }

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("EVN",2)]
  	    [HL7Field(HL7Version.v24, 2, HL7Repeat.False, HL7Required.True,"EVN")]
  	    [HL7Field(HL7Version.v25, 3, HL7Repeat.False, HL7Required.True,"EVN")]
  	    [HL7Field(HL7Version.v251, 3, HL7Repeat.False, HL7Required.True,"EVN")]
  	    [HL7Field(HL7Version.v26, 4, HL7Repeat.False, HL7Required.True,"EVN")]
  	    [HL7Field(HL7Version.v27, 4, HL7Repeat.False, HL7Required.True,"EVN")]
	    public EVN EVN {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("PID",3)]
  	    [HL7Field(HL7Version.v24, 3, HL7Repeat.False, HL7Required.True,"PID")]
  	    [HL7Field(HL7Version.v25, 4, HL7Repeat.False, HL7Required.True,"PID")]
  	    [HL7Field(HL7Version.v251, 4, HL7Repeat.False, HL7Required.True,"PID")]
  	    [HL7Field(HL7Version.v26, 5, HL7Repeat.False, HL7Required.True,"PID")]
  	    [HL7Field(HL7Version.v27, 5, HL7Repeat.False, HL7Required.True,"PID")]
	    public PID PID {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("PD1",5)]
  	    [HL7Field(HL7Version.v24, 5, HL7Repeat.False, HL7Required.False,"PD1")]
  	    [HL7Field(HL7Version.v25, 5, HL7Repeat.False, HL7Required.False,"PD1")]
  	    [HL7Field(HL7Version.v251, 5, HL7Repeat.False, HL7Required.False,"PD1")]
  	    [HL7Field(HL7Version.v26, 6, HL7Repeat.False, HL7Required.False,"PD1")]
  	    [HL7Field(HL7Version.v27, 6, HL7Repeat.False, HL7Required.False,"PD1")]
	    public PD1 PD1 {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("ROL",9)]
  	    [HL7Field(HL7Version.v24, 9, HL7Repeat.True, HL7Required.False,"ROL")]
  	    [HL7Field(HL7Version.v24, 20, HL7Repeat.True, HL7Required.False,"ROL")]
  	    [HL7Field(HL7Version.v25, 6, HL7Repeat.True, HL7Required.False,"ROL")]
  	    [HL7Field(HL7Version.v25, 9, HL7Repeat.True, HL7Required.False,"ROL")]
  	    [HL7Field(HL7Version.v251, 6, HL7Repeat.True, HL7Required.False,"ROL")]
  	    [HL7Field(HL7Version.v251, 9, HL7Repeat.True, HL7Required.False,"ROL")]
  	    [HL7Field(HL7Version.v26, 7, HL7Repeat.True, HL7Required.False,"ROL")]
  	    [HL7Field(HL7Version.v26, 10, HL7Repeat.True, HL7Required.False,"ROL")]
  	    [HL7Field(HL7Version.v27, 7, HL7Repeat.True, HL7Required.False,"ROL")]
  	    [HL7Field(HL7Version.v27, 10, HL7Repeat.True, HL7Required.False,"ROL")]
	    public ROL[] ROL {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("PV1",13)]
  	    [HL7Field(HL7Version.v24, 13, HL7Repeat.False, HL7Required.False,"PV1")]
  	    [HL7Field(HL7Version.v25, 7, HL7Repeat.False, HL7Required.False,"PV1")]
  	    [HL7Field(HL7Version.v251, 7, HL7Repeat.False, HL7Required.False,"PV1")]
  	    [HL7Field(HL7Version.v26, 8, HL7Repeat.False, HL7Required.False,"PV1")]
  	    [HL7Field(HL7Version.v27, 8, HL7Repeat.False, HL7Required.False,"PV1")]
	    public PV1 PV1 {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("PV2",16)]
  	    [HL7Field(HL7Version.v24, 16, HL7Repeat.False, HL7Required.False,"PV2")]
  	    [HL7Field(HL7Version.v25, 8, HL7Repeat.False, HL7Required.False,"PV2")]
  	    [HL7Field(HL7Version.v251, 8, HL7Repeat.False, HL7Required.False,"PV2")]
  	    [HL7Field(HL7Version.v26, 9, HL7Repeat.False, HL7Required.False,"PV2")]
  	    [HL7Field(HL7Version.v27, 9, HL7Repeat.False, HL7Required.False,"PV2")]
	    public PV2 PV2 {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("DB1",25)]
  	    [HL7Field(HL7Version.v24, 25, HL7Repeat.True, HL7Required.False,"DB1")]
  	    [HL7Field(HL7Version.v25, 10, HL7Repeat.True, HL7Required.False,"DB1")]
  	    [HL7Field(HL7Version.v251, 10, HL7Repeat.True, HL7Required.False,"DB1")]
  	    [HL7Field(HL7Version.v26, 11, HL7Repeat.True, HL7Required.False,"DB1")]
  	    [HL7Field(HL7Version.v27, 11, HL7Repeat.True, HL7Required.False,"DB1")]
	    public DB1[] DB1 {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("COMMON_ORDER",28)]
  	    [HL7Field(HL7Version.v24, 28, HL7Repeat.False, HL7Required.False,"COMMON_ORDER_DFT_P11")]
  	    [HL7Field(HL7Version.v25, 11, HL7Repeat.True, HL7Required.False,"COMMON_ORDER_DFT_P11")]
  	    [HL7Field(HL7Version.v251, 11, HL7Repeat.True, HL7Required.False,"COMMON_ORDER_DFT_P11")]
  	    [HL7Field(HL7Version.v26, 12, HL7Repeat.True, HL7Required.False,"COMMON_ORDER_DFT_P11")]
  	    [HL7Field(HL7Version.v27, 12, HL7Repeat.True, HL7Required.False,"COMMON_ORDER_DFT_P11")]
	    public COMMON_ORDER_DFT_P11[] COMMON_ORDER {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("DG1",124)]
  	    [HL7Field(HL7Version.v24, 124, HL7Repeat.True, HL7Required.False,"DG1")]
  	    [HL7Field(HL7Version.v24, 224, HL7Repeat.True, HL7Required.False,"DG1")]
  	    [HL7Field(HL7Version.v25, 26, HL7Repeat.True, HL7Required.False,"DG1")]
  	    [HL7Field(HL7Version.v251, 26, HL7Repeat.True, HL7Required.False,"DG1")]
  	    [HL7Field(HL7Version.v26, 27, HL7Repeat.True, HL7Required.False,"DG1")]
  	    [HL7Field(HL7Version.v27, 27, HL7Repeat.True, HL7Required.False,"DG1")]
	    public DG1[] DG1 {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("DRG",128)]
  	    [HL7Field(HL7Version.v24, 128, HL7Repeat.False, HL7Required.False,"DRG")]
  	    [HL7Field(HL7Version.v24, 225, HL7Repeat.False, HL7Required.False,"DRG")]
  	    [HL7Field(HL7Version.v25, 27, HL7Repeat.False, HL7Required.False,"DRG")]
  	    [HL7Field(HL7Version.v251, 27, HL7Repeat.False, HL7Required.False,"DRG")]
  	    [HL7Field(HL7Version.v26, 28, HL7Repeat.False, HL7Required.False,"DRG")]
  	    [HL7Field(HL7Version.v27, 28, HL7Repeat.False, HL7Required.False,"DRG")]
	    public DRG DRG {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("GT1",132)]
  	    [HL7Field(HL7Version.v24, 132, HL7Repeat.True, HL7Required.False,"GT1")]
  	    [HL7Field(HL7Version.v24, 226, HL7Repeat.True, HL7Required.False,"GT1")]
  	    [HL7Field(HL7Version.v25, 28, HL7Repeat.True, HL7Required.False,"GT1")]
  	    [HL7Field(HL7Version.v251, 28, HL7Repeat.True, HL7Required.False,"GT1")]
  	    [HL7Field(HL7Version.v26, 29, HL7Repeat.True, HL7Required.False,"GT1")]
  	    [HL7Field(HL7Version.v27, 29, HL7Repeat.True, HL7Required.False,"GT1")]
	    public GT1[] GT1 {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("INSURANCE",135)]
  	    [HL7Field(HL7Version.v24, 135, HL7Repeat.False, HL7Required.False,"INSURANCE_DFT_P11")]
  	    [HL7Field(HL7Version.v25, 29, HL7Repeat.True, HL7Required.False,"INSURANCE_DFT_P11")]
  	    [HL7Field(HL7Version.v251, 29, HL7Repeat.True, HL7Required.False,"INSURANCE_DFT_P11")]
  	    [HL7Field(HL7Version.v26, 30, HL7Repeat.True, HL7Required.False,"INSURANCE_DFT_P11")]
  	    [HL7Field(HL7Version.v27, 30, HL7Repeat.True, HL7Required.False,"INSURANCE_DFT_P11")]
	    public INSURANCE_DFT_P11[] INSURANCE {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("ACC",154)]
  	    [HL7Field(HL7Version.v24, 154, HL7Repeat.False, HL7Required.False,"ACC")]
  	    [HL7Field(HL7Version.v25, 35, HL7Repeat.False, HL7Required.False,"ACC")]
  	    [HL7Field(HL7Version.v251, 35, HL7Repeat.False, HL7Required.False,"ACC")]
  	    [HL7Field(HL7Version.v26, 36, HL7Repeat.False, HL7Required.False,"ACC")]
  	    [HL7Field(HL7Version.v27, 36, HL7Repeat.False, HL7Required.False,"ACC")]
	    public ACC ACC {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("FINANCIAL",200)]
  	    [HL7Field(HL7Version.v24, 200, HL7Repeat.True, HL7Required.True,"FINANCIAL_DFT_P11")]
  	    [HL7Field(HL7Version.v25, 36, HL7Repeat.True, HL7Required.True,"FINANCIAL_DFT_P11")]
  	    [HL7Field(HL7Version.v251, 36, HL7Repeat.True, HL7Required.True,"FINANCIAL_DFT_P11")]
  	    [HL7Field(HL7Version.v26, 37, HL7Repeat.True, HL7Required.True,"FINANCIAL_DFT_P11")]
  	    [HL7Field(HL7Version.v27, 37, HL7Repeat.True, HL7Required.True,"FINANCIAL_DFT_P11")]
	    public FINANCIAL_DFT_P11[] FINANCIAL {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("FINANCIAL_COMMON_ORDER",209)]
  	    [HL7Field(HL7Version.v24, 209, HL7Repeat.False, HL7Required.False,"FINANCIAL_COMMON_ORDER_DFT_P11")]
	    public FINANCIAL_COMMON_ORDER_DFT_P11 FINANCIAL_COMMON_ORDER {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("FINANCIAL_INSURANCE",227)]
  	    [HL7Field(HL7Version.v24, 227, HL7Repeat.False, HL7Required.False,"FINANCIAL_INSURANCE_DFT_P11")]
	    public FINANCIAL_INSURANCE_DFT_P11 FINANCIAL_INSURANCE {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("SFT",2)]
  	    [HL7Field(HL7Version.v25, 2, HL7Repeat.True, HL7Required.False,"SFT")]
  	    [HL7Field(HL7Version.v251, 2, HL7Repeat.True, HL7Required.False,"SFT")]
  	    [HL7Field(HL7Version.v26, 2, HL7Repeat.True, HL7Required.False,"SFT")]
  	    [HL7Field(HL7Version.v27, 2, HL7Repeat.True, HL7Required.False,"SFT")]
	    public SFT[] SFT {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
        [PropertyClassification("UAC",3)]
  	    [HL7Field(HL7Version.v26, 3, HL7Repeat.False, HL7Required.False,"UAC")]
  	    [HL7Field(HL7Version.v27, 3, HL7Repeat.False, HL7Required.False,"UAC")]
	    public UAC UAC {get;set;}



		#region Parser Helpers and Conrete Impls

        internal override Stack<string> ConsumeTextSegments(Stack<string> availableData, HL7ParserOptions options) {

				if (HL7Version.v24 == options.Version) {
		 EVN = PopSegmentParseAndCheckRequired<EVN>(availableData, options, "EVN");
		 PID = PopSegmentParseAndCheckRequired<PID>(availableData, options, "PID");
		 PD1 = PopSegmentParseAndCheckRequired<PD1>(availableData, options, "PD1");
		 ROL = PopSegmentParseAndCheckRequiredArray<ROL>(availableData, options, "ROL");
		 PV1 = PopSegmentParseAndCheckRequired<PV1>(availableData, options, "PV1");
		 PV2 = PopSegmentParseAndCheckRequired<PV2>(availableData, options, "PV2");
		 DB1 = PopSegmentParseAndCheckRequiredArray<DB1>(availableData, options, "DB1");
		 COMMON_ORDER = ProcessGroupArray<COMMON_ORDER_DFT_P11>(availableData, options, "COMMON_ORDER");
		 DG1 = PopSegmentParseAndCheckRequiredArray<DG1>(availableData, options, "DG1");
		 DRG = PopSegmentParseAndCheckRequired<DRG>(availableData, options, "DRG");
		 GT1 = PopSegmentParseAndCheckRequiredArray<GT1>(availableData, options, "GT1");
		 INSURANCE = ProcessGroupArray<INSURANCE_DFT_P11>(availableData, options, "INSURANCE");
		 ACC = PopSegmentParseAndCheckRequired<ACC>(availableData, options, "ACC");
		 FINANCIAL = ProcessGroupArray<FINANCIAL_DFT_P11>(availableData, options, "FINANCIAL");
		 FINANCIAL_COMMON_ORDER = ProcessGroup<FINANCIAL_COMMON_ORDER_DFT_P11>(availableData, options, "FINANCIAL_COMMON_ORDER");
		 FINANCIAL_INSURANCE = ProcessGroup<FINANCIAL_INSURANCE_DFT_P11>(availableData, options, "FINANCIAL_INSURANCE");
		}
		if (HL7Version.v25 == options.Version) {
		 EVN = PopSegmentParseAndCheckRequired<EVN>(availableData, options, "EVN");
		 PID = PopSegmentParseAndCheckRequired<PID>(availableData, options, "PID");
		 PD1 = PopSegmentParseAndCheckRequired<PD1>(availableData, options, "PD1");
		 ROL = PopSegmentParseAndCheckRequiredArray<ROL>(availableData, options, "ROL");
		 PV1 = PopSegmentParseAndCheckRequired<PV1>(availableData, options, "PV1");
		 PV2 = PopSegmentParseAndCheckRequired<PV2>(availableData, options, "PV2");
		 DB1 = PopSegmentParseAndCheckRequiredArray<DB1>(availableData, options, "DB1");
		 COMMON_ORDER = ProcessGroupArray<COMMON_ORDER_DFT_P11>(availableData, options, "COMMON_ORDER");
		 DG1 = PopSegmentParseAndCheckRequiredArray<DG1>(availableData, options, "DG1");
		 DRG = PopSegmentParseAndCheckRequired<DRG>(availableData, options, "DRG");
		 GT1 = PopSegmentParseAndCheckRequiredArray<GT1>(availableData, options, "GT1");
		 INSURANCE = ProcessGroupArray<INSURANCE_DFT_P11>(availableData, options, "INSURANCE");
		 ACC = PopSegmentParseAndCheckRequired<ACC>(availableData, options, "ACC");
		 FINANCIAL = ProcessGroupArray<FINANCIAL_DFT_P11>(availableData, options, "FINANCIAL");
		 SFT = PopSegmentParseAndCheckRequiredArray<SFT>(availableData, options, "SFT");
		}
		if (HL7Version.v251 == options.Version) {
		 EVN = PopSegmentParseAndCheckRequired<EVN>(availableData, options, "EVN");
		 PID = PopSegmentParseAndCheckRequired<PID>(availableData, options, "PID");
		 PD1 = PopSegmentParseAndCheckRequired<PD1>(availableData, options, "PD1");
		 ROL = PopSegmentParseAndCheckRequiredArray<ROL>(availableData, options, "ROL");
		 PV1 = PopSegmentParseAndCheckRequired<PV1>(availableData, options, "PV1");
		 PV2 = PopSegmentParseAndCheckRequired<PV2>(availableData, options, "PV2");
		 DB1 = PopSegmentParseAndCheckRequiredArray<DB1>(availableData, options, "DB1");
		 COMMON_ORDER = ProcessGroupArray<COMMON_ORDER_DFT_P11>(availableData, options, "COMMON_ORDER");
		 DG1 = PopSegmentParseAndCheckRequiredArray<DG1>(availableData, options, "DG1");
		 DRG = PopSegmentParseAndCheckRequired<DRG>(availableData, options, "DRG");
		 GT1 = PopSegmentParseAndCheckRequiredArray<GT1>(availableData, options, "GT1");
		 INSURANCE = ProcessGroupArray<INSURANCE_DFT_P11>(availableData, options, "INSURANCE");
		 ACC = PopSegmentParseAndCheckRequired<ACC>(availableData, options, "ACC");
		 FINANCIAL = ProcessGroupArray<FINANCIAL_DFT_P11>(availableData, options, "FINANCIAL");
		 SFT = PopSegmentParseAndCheckRequiredArray<SFT>(availableData, options, "SFT");
		}
		if (HL7Version.v26 == options.Version) {
		 EVN = PopSegmentParseAndCheckRequired<EVN>(availableData, options, "EVN");
		 PID = PopSegmentParseAndCheckRequired<PID>(availableData, options, "PID");
		 PD1 = PopSegmentParseAndCheckRequired<PD1>(availableData, options, "PD1");
		 ROL = PopSegmentParseAndCheckRequiredArray<ROL>(availableData, options, "ROL");
		 PV1 = PopSegmentParseAndCheckRequired<PV1>(availableData, options, "PV1");
		 PV2 = PopSegmentParseAndCheckRequired<PV2>(availableData, options, "PV2");
		 DB1 = PopSegmentParseAndCheckRequiredArray<DB1>(availableData, options, "DB1");
		 COMMON_ORDER = ProcessGroupArray<COMMON_ORDER_DFT_P11>(availableData, options, "COMMON_ORDER");
		 DG1 = PopSegmentParseAndCheckRequiredArray<DG1>(availableData, options, "DG1");
		 DRG = PopSegmentParseAndCheckRequired<DRG>(availableData, options, "DRG");
		 GT1 = PopSegmentParseAndCheckRequiredArray<GT1>(availableData, options, "GT1");
		 INSURANCE = ProcessGroupArray<INSURANCE_DFT_P11>(availableData, options, "INSURANCE");
		 ACC = PopSegmentParseAndCheckRequired<ACC>(availableData, options, "ACC");
		 FINANCIAL = ProcessGroupArray<FINANCIAL_DFT_P11>(availableData, options, "FINANCIAL");
		 SFT = PopSegmentParseAndCheckRequiredArray<SFT>(availableData, options, "SFT");
		 UAC = PopSegmentParseAndCheckRequired<UAC>(availableData, options, "UAC");
		}
		if (HL7Version.v27 == options.Version) {
		 EVN = PopSegmentParseAndCheckRequired<EVN>(availableData, options, "EVN");
		 PID = PopSegmentParseAndCheckRequired<PID>(availableData, options, "PID");
		 PD1 = PopSegmentParseAndCheckRequired<PD1>(availableData, options, "PD1");
		 ROL = PopSegmentParseAndCheckRequiredArray<ROL>(availableData, options, "ROL");
		 PV1 = PopSegmentParseAndCheckRequired<PV1>(availableData, options, "PV1");
		 PV2 = PopSegmentParseAndCheckRequired<PV2>(availableData, options, "PV2");
		 DB1 = PopSegmentParseAndCheckRequiredArray<DB1>(availableData, options, "DB1");
		 COMMON_ORDER = ProcessGroupArray<COMMON_ORDER_DFT_P11>(availableData, options, "COMMON_ORDER");
		 DG1 = PopSegmentParseAndCheckRequiredArray<DG1>(availableData, options, "DG1");
		 DRG = PopSegmentParseAndCheckRequired<DRG>(availableData, options, "DRG");
		 GT1 = PopSegmentParseAndCheckRequiredArray<GT1>(availableData, options, "GT1");
		 INSURANCE = ProcessGroupArray<INSURANCE_DFT_P11>(availableData, options, "INSURANCE");
		 ACC = PopSegmentParseAndCheckRequired<ACC>(availableData, options, "ACC");
		 FINANCIAL = ProcessGroupArray<FINANCIAL_DFT_P11>(availableData, options, "FINANCIAL");
		 SFT = PopSegmentParseAndCheckRequiredArray<SFT>(availableData, options, "SFT");
		 UAC = PopSegmentParseAndCheckRequired<UAC>(availableData, options, "UAC");
		}
			if (availableData != null && availableData.Count > 0) {
				ConsumeZSegmentsFromText(availableData, options);
			}
            return availableData;
        
        }

        private static Dictionary<string, bool> SEGMENT_VERSION_REQUIRED_MAP = new Dictionary<string, bool>();

		protected override Dictionary<string, bool> MAP_OF_SEGMENT_TO_REQUIRED
        {
            get
			{
				return SEGMENT_VERSION_REQUIRED_MAP;
			}
        }

		public override string HL7ENTITY_TYPE_NAME
        {
            get {
				return "DFT_P11";
			}
        }

        static DFT_P11() {

             SetupStaticPropertyMap(SEGMENT_VERSION_REQUIRED_MAP, typeof(DFT_P11));

        }

		#endregion

		public override string GetER7(HL7ParserOptions options)
		{
			List<string> segmentData = new List<string>();
			if (MSH != null) {
				segmentData.Add(MSH.GetER7(options));
			}
			if (EVN != null) {
				segmentData.Add(EVN.GetER7(options));
			}
			if (PID != null) {
				segmentData.Add(PID.GetER7(options));
			}
			if (PD1 != null) {
				segmentData.Add(PD1.GetER7(options));
			}
			if (ROL != null && ROL.Length > 0) {
				for (int i = 0; i < ROL.Length; i++) {
					segmentData.Add(ROL[i].GetER7(options));
				}
			}
			if (PV1 != null) {
				segmentData.Add(PV1.GetER7(options));
			}
			if (PV2 != null) {
				segmentData.Add(PV2.GetER7(options));
			}
			if (DB1 != null && DB1.Length > 0) {
				for (int i = 0; i < DB1.Length; i++) {
					segmentData.Add(DB1[i].GetER7(options));
				}
			}
			if (COMMON_ORDER != null && COMMON_ORDER.Length > 0) {
				for (int i = 0; i < COMMON_ORDER.Length; i++) {
					segmentData.Add(COMMON_ORDER[i].GetER7(options));
				}
			}
			if (DG1 != null && DG1.Length > 0) {
				for (int i = 0; i < DG1.Length; i++) {
					segmentData.Add(DG1[i].GetER7(options));
				}
			}
			if (DRG != null) {
				segmentData.Add(DRG.GetER7(options));
			}
			if (GT1 != null && GT1.Length > 0) {
				for (int i = 0; i < GT1.Length; i++) {
					segmentData.Add(GT1[i].GetER7(options));
				}
			}
			if (INSURANCE != null && INSURANCE.Length > 0) {
				for (int i = 0; i < INSURANCE.Length; i++) {
					segmentData.Add(INSURANCE[i].GetER7(options));
				}
			}
			if (ACC != null) {
				segmentData.Add(ACC.GetER7(options));
			}
			if (FINANCIAL != null && FINANCIAL.Length > 0) {
				for (int i = 0; i < FINANCIAL.Length; i++) {
					segmentData.Add(FINANCIAL[i].GetER7(options));
				}
			}
			if (FINANCIAL_COMMON_ORDER != null) {
				segmentData.Add(FINANCIAL_COMMON_ORDER.GetER7(options));
			}
			if (FINANCIAL_INSURANCE != null) {
				segmentData.Add(FINANCIAL_INSURANCE.GetER7(options));
			}
			if (SFT != null && SFT.Length > 0) {
				for (int i = 0; i < SFT.Length; i++) {
					segmentData.Add(SFT[i].GetER7(options));
				}
			}
			if (UAC != null) {
				segmentData.Add(UAC.GetER7(options));
			}
           segmentData.AddRange(GetZSegmentsER7(options));
		   return string.Join(HL7ParserConstants.SEGMENT_SEPARATOR, segmentData.ToArray());
        
        }


    }
}

